package com.dhx.service.impl;

import com.dhx.dao.UserDao;
import com.dhx.dao.impl.UserDaoImpl;
import com.dhx.pojo.User;
import com.dhx.service.UserService;

public class UserServiceImpl implements UserService {
    private UserDao userDao = new UserDaoImpl();

    @Override
    public void registUser(User user) {
        userDao.saveUser(user);
    }

    @Override
    public User login(User user) {
        return userDao.queryUserById(user.getId(), user.getPassword(),user.getCate());
    }

    @Override
    public boolean existsUsername(String username) {
        if (userDao.queryUserById(username) == false) {
            return false;
        }
        return true;
    }

}
